feat(blue-sdk): accrue nested Vault V2 entities to a single timestamp - #911
Draft
Foulks-Plb wants to merge 2 commits into
Draft
feat(blue-sdk): accrue nested Vault V2 entities to a single timestamp#911Foulks-Plb wants to merge 2 commits into
Foulks-Plb wants to merge 2 commits into
Conversation
AccrualVaultV2.accrueInterest now accrues every underlying adapter, market, and position to the same timestamp, so the returned entity graph shares one `lastUpdate` — matching MetaMorpho V1 (AccrualVault.accrueInterest) instead of leaving nested adapters at pre-accrual state. Adds an additive `accrueInterest(timestamp?)` method to IAccrualVaultV2Adapter and each adapter. Vault-level `_totalAssets`, `totalSupply`, and fee shares are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: feb22102f6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Make the new IAccrualVaultV2Adapter.accrueInterest method optional and guard the vault call with a fallback, so adding it stays backward compatible (minor, not major): pre-existing TS/JS adapters without it are left at their pre-accrual state instead of failing to compile or crashing at runtime. Require the timestamp argument so every nested market accrues to the same instant rather than each defaulting to its own lastUpdate. Complete the JSDoc contract (@returns, @throws, @example) on the interface method, its implementations, and AccrualVaultV2.accrueInterest. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
AccrualVaultV2.accrueInterestadvanced only vault-level accounting while leaving its nested adapters, markets, and positions at their pre-accruallastUpdate— so the returned entity graph was internally inconsistent and diverged from MetaMorpho V1 (AccrualVault.accrueInterest), which accrues its nested positions.Solution
Accrue every underlying adapter and the liquidity adapter (and, transitively, their markets / positions / nested V1 vault) to the same timestamp, so the whole returned graph shares one
lastUpdate; this adds an additiveaccrueInterest(timestamp?)method toIAccrualVaultV2Adapterand each adapter implementation. Vault-level_totalAssets,totalSupply, and fee shares are byte-for-byte unchanged (nested re-accrual is idempotent at a fixed timestamp), backed by new unit tests. Ships ablue-sdkminor changeset with patch bumps for the direct maintained dependents (blue-sdk-viem,morpho-sdk,wdk-protocol-lending-morpho-evm).🤖 Generated with Claude Code